import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'
// import requireTransform from "vite-plugin-require-transform";
import commonjs from 'vite-plugin-commonjs';

export default defineConfig({
  plugins: [
    react(),
    commonjs(),
    // requireTransform({
    //   fileRegex: /.js$|.jsx$/,
    // }),
  ],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, 'src')
    },
  },
  server: {
    proxy: {
      '/api': {
        target: 'http://jsonplaceholder.typicode.com',
        changeOrigin: true,
        pathRewrite: {
          '^/api': ''
        }
      }
    }
  },
  
})
